getString

open fun getString(@NonNull context: Context, resId: Int): String(source)

Gets the resource string that also respects the per-app locales. If developers set the per-app locales via setApplicationLocales, this API returns localized strings even if the context is not androidx.appcompat.app.AppCompatActivity.

Compatibility behavior:

  • API 17 and above, this method return the localized string that respects per-app locales.
  • API 16 and earlier, this method directly return the result of getString